The present invention relates to power failure detection, and more particularly to early AC power detection.
The use of alternating current (AC) to power electronic devices is very well known in the art. When AC power fails, the voltage drops to zero volts within a few milliseconds. The devices may use the time between the detection of the AC power failure and the drop to zero volts to perform power down operations, such as saving important system information.
FIG. 1 illustrates a conventional method of detecting an AC power failure. FIG. 1 illustrates a sample AC power waveform 102 with a periodicity of t2. Within one period, the waveform 102 has two zero-crossings, at t1, and t2. Knowing the periodicity of the waveform 102, its zero-crossings may be anticipated. Thus, at times t1, t2 and t4, the waveform 102 will cross zero volts if the AC power has not failed. The conventional method thus uses a zero-crossing detection circuit to detect whether or not the waveform 102 crosses zero at the anticipated times, t1, t2, and t4.
For example, assume that the AC power waveform 102 fails at t3. At t4, the zero-crossing detection circuit detects if the waveform 102 crosses zero volts. Since the AC power waveform 102 has failed, it does not. Thus, the AC power failure is detected at t4. A signal indicating the failure may then be sent to initiate the power down operations for the device.
However, under the conventional method, the AC power failure is not detected until time t4, although the AC power failed at the earlier time, t3. Thus, there is a lag time between the actual AC power failure and its detection. The device is thus not able to use this time period to perform more extensive power down operations.
Accordingly, there exists a need for an improved method and apparatus for AC power failure detection. The method and apparatus should be easy to implement and able to detect an AC power failure earlier than conventional methods. The present invention addresses such a need.
The present invention provides a method and apparatus for alternating current (AC) power failure detection. The method includes amplifying an AC power waveform, where the amplified waveform is asserted when the AC power waveform is in a vicinity of a zerocrossing and negated at all other times; initiating a counter when the amplified waveform is asserted; and determining if the counter equals or exceeds a reference number, where the counter being equal or exceeding the reference number indicates an AC power failure. The present invention converts an AC power signal to a near digital signal, where the near digital signal is asserted when the AC power signal is in the vicinity of a zero-crossing and negated at all other times. When the near digital signal is asserted, a counter in a controller begins counting, and ends the counting when the near digital signal is negated. If the counter equals or exceeds a reference number before the near digital signal is negated, then a failure of the AC power signal is detected. A signal indicating the AC power failure is then output by the controller to initiate power down operations. By measuring the length of time the AC power signal remains in the vicinity of a zero-crossing, a failure of the AC power can be detected earlier than with conventional methods. This allows more time to perform power down operations.